home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / promode3.zip / PROMODEM.H < prev    next >
C/C++ Source or Header  |  1993-01-06  |  4KB  |  117 lines

  1. #define MAX_IRQ_ROUTINES    10
  2.  
  3. typedef struct serialControlBlock
  4.     {
  5.     int com_data;
  6.     int com_ier;
  7.     int com_ists;
  8.     int com_setings;
  9.     int com_mcr;
  10.     int com_sts;
  11.     int com_dunno;
  12.     int pointer1,pointer2;
  13.     int com_int;
  14.     char *irq_buffer;
  15.     int bufferSize;
  16.     int irqIndex;
  17.     long status;
  18.     } AJMS;
  19.  
  20. int  OpenCom             (AJMS *controlBlock);
  21. int  CloseCom            (AJMS *controlBlock);
  22. int  SendCharacter       (AJMS *controlBlock, unsigned char ch);
  23. int  CheckQueue          (AJMS *controlBlock);
  24. int  GetCharacter        (AJMS *controlBlock);
  25. void ClearQueue          (AJMS *controlBlock);
  26. int  GetCarrierDetect    (AJMS *controlBlock);
  27. void SetBaudRate         (AJMS *controlBlock, unsigned long baudRate);
  28. void SetDTR              (AJMS *controlBlock);
  29. void DropDTR             (AJMS *controlBlock);
  30. void SetDataFormat       (AJMS *controlBlock, int options);
  31. int  SendString          (AJMS *controlBlock, char *string);
  32. int  SetFIFOMode         (AJMS *controlBlock);
  33. int  WaitForCharacter    (AJMS *controlBlock, double seconds);
  34. int  SetFIFOTriggerLevel (AJMS *controlBlock, unsigned char parameter);
  35. void DisableIRQ          (AJMS *controlBlock);
  36. void EnableIRQ           (AJMS *controlBlock);
  37.  
  38.  
  39. int SetupControlBlock(AJMS *controlBlock,
  40.               unsigned int baseAddress,
  41.               int irq,
  42.               unsigned int bufferSize);
  43.  
  44. #define BIT_0          1
  45. #define BIT_1          2
  46. #define BIT_2          4
  47. #define BIT_3          8
  48. #define BIT_4          16
  49. #define BIT_5          32
  50. #define BIT_6          64
  51. #define BIT_7          128
  52.  
  53. #define I_IRQ3         0x0b
  54. #define I_IRQ4         0x0c
  55.  
  56. #define PIC_MASK       0x21
  57. #define PIC_EOI        0x20
  58. #define PIC_OFFSET     0x08
  59. #define INT_MASK       0x08
  60.  
  61. /* Parameters for SetFIFOTriggerLevel */
  62. #define FIFO_1_TRIGGER            (unsigned char)0
  63. #define FIFO_4_TRIGGER            (unsigned char)64
  64. #define FIFO_8_TRIGGER            (unsigned char)128
  65. #define FIFO_16_TRIGGER           (unsigned char)192
  66.  
  67. /* Parameters for SetDataFormat */
  68. #define  BITS_5        0     /* Neither Bit 0 or 1 is set         */
  69. #define  BITS_6        1     /* Bit 0 of Data Format Register     */
  70. #define  BITS_7        2     /* Bit 1 of Data Format Register     */
  71. #define  BITS_8        3     /* Bit 0 & 1 of Data Format Register */
  72. #define  STOP_BITS_1   0     /* Bit 2 not Set in Data Format Register */
  73. #define  STOP_BITS_2   4     /* Bit 2 Set in Data Format Register     */
  74. #define  PARITY_ON     8     /* Bit 3 set in Data Format Register     */
  75. #define  NO_PARITY     0     /* Bit 3 not set in Data Format Register */
  76. #define  EVEN_PARITY   16    /* Bit 4 set in Data Format Register     */
  77. #define  ODD_PARITY    0     /* Bit 4 not set in Data Format Register */
  78. #define  STICK_PARITY  32    /* Bit 5 set in Data Format Register     */
  79. #define  SET_BREAK     64    /* Bit 6 set in Data Format Register     */
  80.  
  81. /* Error Codes for SetupControlBlock */
  82. #define SUCCESSFUL               0
  83. #define TOO_MANY_IRQS            1
  84.  
  85. /* Return Codes for OpenCom */
  86. #define SUCCESSFUL               0
  87. #define BUFFER_ALLOCATION_ERROR  1
  88. #define COM_ALREADY_OPEN         2
  89.  
  90. /* Return Codes for CloseCom */
  91. #define SUCCESSFUL         0
  92. #define COM_PORT_NOT_OPEN  1
  93.  
  94. /* Return Codes for SendCharacter */
  95. #define CARRIER                  1
  96. #define NO_CARRIER               0
  97.  
  98. /* Return Codes for CheckQueue */
  99. #define CHARACTERS_WAITING       1
  100. #define QUEUE_EMPTY              0
  101.  
  102. /* Return Codes for GetCarrierDetect */
  103. #define CARRIER                  1
  104. #define NO_CARRIER               0
  105.  
  106. /* Return Codes for SetFIFOMode */
  107. #define FIFO_ENABLED             1
  108. #define NO_FIFO_PRESENT          0
  109.  
  110. /* Return Codes for WaitForCharacter */
  111. #define WAIT_TIME_OUT                 0
  112.  
  113. /* Return Codes for SetFIFOTriggerLevel */
  114. #define INVALID_TRIGGER_LEVEL         1
  115. #define SUCCESSFUL                    0
  116.  
  117.